// The Vue build version to load with the `import` command
// (runtime-only or standalone) has been set in webpack.base.conf with an alias.
import Vue from 'vue'
import App from './App.vue'
import VueRouter from "vue-router"
import VueResource from "vue-resource"
import store from './vuex/store'
import axios from 'axios'
Vue.prototype.$http = axios

import Vant from 'vant';
import 'vant/lib/vant-css/index.css';

import tabbar from './components/tabbar.vue' //选项底部
import home from './components/home.vue'     //首页
import person from './components/person.vue'  //我的
import login from './components/login.vue'    //登录注册
import findPsw from './components/findPsw.vue'  //找回密码
import searchSome from './components/searchSome.vue'    //搜索商品
import newOne from './components/newOne.vue'  //发布物品
import userMsg from './components/userMsg.vue'  //个人信息
import setting from './components/setting.vue'  //设置
import mygoods from './components/mygoods.vue'  //我的发布
import goodMsg from './components/goodMsg.vue'  //商品详情页
import colletion from './components/colletion.vue'  //收藏夹

Vue.config.debug = true;
Vue.use(VueRouter);
Vue.use(VueResource);
Vue.use(Vant);

// 创建一个路由器实例并且配置路由规则
const router = new VueRouter({
  mode: 'history',
  base: __dirname,
  routes : [{
    path : '/',
    components : {tabbar:tabbar},
    children:[
      { path : 'home', component : home},
      { path : 'person', component : person},
      { path : 'login', component : login},
      { path : 'findPsw', component : findPsw},        
      { path : 'searchSome', component : searchSome},
      { path : 'newOne', component : newOne},
      { path : 'userMsg', component : userMsg},
      { path : 'setting', component : setting},
      { path : 'mygoods', component : mygoods},
      { path : 'goodMsg', component : goodMsg},
      { path : 'colletion', component : colletion}
    ]}
  ]
})
router.replace('/home');
// 路由器会创建一个 App 实例，并且挂载到选择符 #app 匹配的元素上。
  const app = new Vue({
    router: router,
    store,
    render: h => h(App)
}).$mount('#app')
